#!/usr/bin/perl -w
#$Source Volumes://MATEOR/prlserverapi/setup.pl$
#$Revision: 0.01-0a$
#$Date: May 20, 2012$
#
#--------------
# PrlServerAPI Copyright Matthew Caswell, 2012
#--------------
#

use strict;
use Storable;
use Define;

my($SERVER);
my($ebp);
my($MAIL);
my($psaal);
my($psaal_h);

$ebp = Define::String($ebp, '0:1', 'LOGIC');
$ebp = Define::String($ebp, '0', 'LOGIC}->{LOW');
$ebp = Define::String($ebp, '1', 'LOGIC}->{HIGH');


#
# Wipe the psalogin.rc file and refresh it with custom Storable.pm
#

open FILE, '>psalogin.rc' or die "Couldn't open psalogin.rc: $!\n";
print FILE "\0";
close FILE;

$SERVER->{account}->{guest} = "guest";  # $SERVER->{account}->{$user} = $password;
$SERVER->{account}->{guest2} = "guest";
store $SERVER->{account}, 'psalogin.rc';

#
# Wipe the psauser.rc and refresh it.
#

open FILE, '>psauser.rc' or die "Couldn't open psauser.rc: $!\n";
print FILE "\0";
close FILE;

$SERVER->{AUTH}->{guest} = Define::pull($ebp, 'LOGIC}->{LOW');
$SERVER->{AUTH}->{guest2} = Define::pull($ebp, 'LOGIC}->{LOW');
$SERVER->{AUTH}->{Client} = Define::pull($ebp, 'LOGIC}->{LOW');
store $SERVER->{AUTH}, 'psauser.rc';

#
# Wipe AmericanMail.rc
#

open FILE, '>AmericanMail.rc'
  or die "Couldn't open AmericanMail.rc: $!\n";
print FILE "\0";
close FILE;

$MAIL->{TO} = $MAIL->{FROM} = $MAIL->{BODY} = "\0";
$MAIL->{GETCH} = 0xFF;
store $MAIL, 'AmericanMail.rc';

#
# Wipe psaal.rc
#

open FILE, '>psaal.rc'
  or die "Couldn't open psaal.rc: $!\n";
print "\0";
close FILE;

$psaal_h = {
  uname => 'Client',
  passw => "\0"
};

$psaal->{Client} = $psaal_h;
store $psaal, 'psaal.rc';

# $psaal->{Client}->{uname} = $ {$psaal->{Client}} {uname}
